using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._DataManagementTools._Fields
{
    /// <summary>
    /// <para>Alter Field</para>
    /// <para>Renames fields and field aliases, or alters field properties.</para>
    /// <para>重命名字段和字段别名，或更改字段属性。</para>
    /// </summary>    
    [DisplayName("Alter Field")]
    public class AlterField : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public AlterField()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_in_table">
        /// <para>Input Table</para>
        /// <para>The input table or feature class that contains the field to alter.</para>
        /// <para>包含要更改的字段的输入表或要素类。</para>
        /// </param>
        /// <param name="_field">
        /// <para>Field Name</para>
        /// <para>The name of the field to alter. If the field is a required field (isRequired=true), only the field alias can be altered.</para>
        /// <para>要更改的字段的名称。如果字段是必填字段 （isRequired=true），则只能更改字段别名。</para>
        /// </param>
        public AlterField(object _in_table, object _field)
        {
            this._in_table = _in_table;
            this._field = _field;
        }
        public override string ToolboxName => "Data Management Tools";

        public override string ToolName => "Alter Field";

        public override string CallName => "management.AlterField";

        public override List<string> AcceptEnvironments => ["workspace"];

        public override object[] ParameterInfo => [_in_table, _field, _new_field_name, _new_field_alias, _field_type.GetGPValue(), _field_length, _field_is_nullable.GetGPValue(), _clear_field_alias.GetGPValue(), _out_table];

        /// <summary>
        /// <para>Input Table</para>
        /// <para>The input table or feature class that contains the field to alter.</para>
        /// <para>包含要更改的字段的输入表或要素类。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _in_table { get; set; }


        /// <summary>
        /// <para>Field Name</para>
        /// <para>The name of the field to alter. If the field is a required field (isRequired=true), only the field alias can be altered.</para>
        /// <para>要更改的字段的名称。如果字段是必填字段 （isRequired=true），则只能更改字段别名。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Field Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _field { get; set; }


        /// <summary>
        /// <para>New Field Name</para>
        /// <para>The new name for the field.</para>
        /// <para>字段的新名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("New Field Name")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _new_field_name { get; set; } = null;


        /// <summary>
        /// <para>New Field Alias</para>
        /// <para>The new field alias for the field.</para>
        /// <para>字段的新字段别名。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("New Field Alias")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _new_field_alias { get; set; } = null;


        /// <summary>
        /// <para>New Field Type</para>
        /// <para><xdoc>
        ///   <para>Specifies the new field type for the field. This property is only applicable if the input table is empty (does not contain records).</para>
        ///   <bulletList>
        ///     <bullet_item>Text—Any string of characters.</bullet_item><para/>
        ///     <bullet_item>Float (single precision)— Fractional numbers between -3.4E38 and 1.2E38.</bullet_item><para/>
        ///     <bullet_item>Double (double precision)— Fractional numbers between -2.2E308 and 1.8E308.</bullet_item><para/>
        ///     <bullet_item>Short (small integer)— Whole numbers between -32,768 and 32,767.</bullet_item><para/>
        ///     <bullet_item>Long (large integer)— Whole numbers between -2,147,483,648 and 2,147,483,647.</bullet_item><para/>
        ///     <bullet_item>Date—Date and/or time.</bullet_item><para/>
        ///     <bullet_item>Blob (binary data)—Long sequence of binary numbers. You need a custom loader or viewer or a third-party application to load items into a BLOB field or view the contents of a BLOB field.</bullet_item><para/>
        ///     <bullet_item>Raster imagery—Raster images. All ArcGIS software-supported raster dataset formats can be stored, but it is highly recommended that only small images be used.</bullet_item><para/>
        ///     <bullet_item>GUID (globally unique identifier)—Globally unique identifier.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定字段的新字段类型。仅当输入表为空（不包含记录）时，此属性才适用。</para>
        ///   <bulletList>
        ///     <bullet_item>文本 - 任意字符串。</bullet_item><para/>
        ///     <bullet_item>浮点数（单精度）— 介于 -3.4E38 和 1.2E38 之间的小数。</bullet_item><para/>
        ///     <bullet_item>双精度（双精度）— 介于 -2.2E308 和 1.8E308 之间的小数。</bullet_item><para/>
        ///     <bullet_item>短（小整数）— -32,768 和 32,767 之间的整数。</bullet_item><para/>
        ///     <bullet_item>长整数（大整数）— 介于 -2,147,483,648 和 2,147,483,647 之间的整数。</bullet_item><para/>
        ///     <bullet_item>日期 - 日期和/或时间。</bullet_item><para/>
        ///     <bullet_item>Blob（二进制数据）- 二进制数的长序列。您需要自定义加载程序或查看器或第三方应用程序才能将项目加载到 BLOB 字段或查看 BLOB 字段的内容。</bullet_item><para/>
        ///     <bullet_item>栅格影像 - 栅格影像。可以存储所有 ArcGIS 软件支持的栅格数据集格式，但强烈建议仅使用小型影像。</bullet_item><para/>
        ///     <bullet_item>GUID（全局唯一标识符）- 全局唯一标识符。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("New Field Type")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _field_type_value _field_type { get; set; } = _field_type_value._LONG;

        public enum _field_type_value
        {
            /// <summary>
            /// <para>Text</para>
            /// <para>Text—Any string of characters.</para>
            /// <para>文本 - 任意字符串。</para>
            /// </summary>
            [Description("Text")]
            [GPEnumValue("TEXT")]
            _TEXT,

            /// <summary>
            /// <para>Float (single precision)</para>
            /// <para>Float (single precision)— Fractional numbers between -3.4E38 and 1.2E38.</para>
            /// <para>浮点数（单精度）— 介于 -3.4E38 和 1.2E38 之间的小数。</para>
            /// </summary>
            [Description("Float (single precision)")]
            [GPEnumValue("FLOAT")]
            _FLOAT,

            /// <summary>
            /// <para>Double  (double precision)</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("Double  (double precision)")]
            [GPEnumValue("DOUBLE")]
            _DOUBLE,

            /// <summary>
            /// <para>Short (small integer)</para>
            /// <para>Short (small integer)— Whole numbers between -32,768 and 32,767.</para>
            /// <para>短（小整数）— -32,768 和 32,767 之间的整数。</para>
            /// </summary>
            [Description("Short (small integer)")]
            [GPEnumValue("SHORT")]
            _SHORT,

            /// <summary>
            /// <para>Long (large integer)</para>
            /// <para>Long (large integer)— Whole numbers between -2,147,483,648 and 2,147,483,647.</para>
            /// <para>长整数（大整数）— 介于 -2,147,483,648 和 2,147,483,647 之间的整数。</para>
            /// </summary>
            [Description("Long (large integer)")]
            [GPEnumValue("LONG")]
            _LONG,

            /// <summary>
            /// <para>Date</para>
            /// <para>Date—Date and/or time.</para>
            /// <para>日期 - 日期和/或时间。</para>
            /// </summary>
            [Description("Date")]
            [GPEnumValue("DATE")]
            _DATE,

            /// <summary>
            /// <para>Blob (binary data)</para>
            /// <para>Blob (binary data)—Long sequence of binary numbers. You need a custom loader or viewer or a third-party application to load items into a BLOB field or view the contents of a BLOB field.</para>
            /// <para>Blob（二进制数据）- 二进制数的长序列。您需要自定义加载程序或查看器或第三方应用程序才能将项目加载到 BLOB 字段或查看 BLOB 字段的内容。</para>
            /// </summary>
            [Description("Blob (binary data)")]
            [GPEnumValue("BLOB")]
            _BLOB,

            /// <summary>
            /// <para>Raster imagery</para>
            /// <para>Raster imagery—Raster images. All ArcGIS software-supported raster dataset formats can be stored, but it is highly recommended that only small images be used.</para>
            /// <para>栅格影像 - 栅格影像。可以存储所有 ArcGIS 软件支持的栅格数据集格式，但强烈建议仅使用小型影像。</para>
            /// </summary>
            [Description("Raster imagery")]
            [GPEnumValue("RASTER")]
            _RASTER,

            /// <summary>
            /// <para>GUID (globally unique identifier)</para>
            /// <para>GUID (globally unique identifier)—Globally unique identifier.</para>
            /// <para>GUID（全局唯一标识符）- 全局唯一标识符。</para>
            /// </summary>
            [Description("GUID (globally unique identifier)")]
            [GPEnumValue("GUID")]
            _GUID,

        }

        /// <summary>
        /// <para>New Field Length</para>
        /// <para>The new length of the field. This sets the maximum number of allowable characters for each record of the field. This option is only applicable to fields of type Text or Blob (binary data). If the table is empty, the field length can be either increased or decreased. If the table is not empty, the length can only be increased from the current value.</para>
        /// <para>字段的新长度。这将设置字段每条记录允许的最大字符数。此选项仅适用于 Text 或 Blob（二进制数据）类型的字段。如果表为空，则可以增加或减少字段长度。如果表不为空，则只能从当前值增加长度。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("New Field Length")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public long? _field_length { get; set; } = null;


        /// <summary>
        /// <para>New Field IsNullable</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the field can contain null values. Null values are only supported for fields in a geodatabase. This option is only applicable if the table is empty (does not contain records).</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The field will allow null values. This is the default.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The field will not allow null values.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定字段是否可以包含 null 值。只有地理数据库中的字段才支持空值。仅当表为空（不包含记录）时，此选项才适用。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 该字段将允许空值。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>未选中 - 该字段不允许空值。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("New Field IsNullable")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _field_is_nullable_value _field_is_nullable { get; set; } = _field_is_nullable_value._true;

        public enum _field_is_nullable_value
        {
            /// <summary>
            /// <para>NULLABLE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NULLABLE")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>NON_NULLABLE</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("NON_NULLABLE")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Clear Alias</para>
        /// <para><xdoc>
        ///   <para>Specifies whether the alias for the input field will be cleared. The field alias parameter must be empty to clear the alias of the field.</para>
        ///   <bulletList>
        ///     <bullet_item>Checked—The field alias will be cleared (set to null). The field alias parameter must be empty.</bullet_item><para/>
        ///     <bullet_item>Unchecked—The field alias will not be cleared. This is the default.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定是否清除输入字段的别名。字段别名参数必须为空才能清除字段的别名。</para>
        ///   <bulletList>
        ///     <bullet_item>选中 - 字段别名将被清除（设置为 null）。字段别名参数必须为空。</bullet_item><para/>
        ///     <bullet_item>未选中 - 不会清除字段别名。这是默认设置。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Clear Alias")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _clear_field_alias_value _clear_field_alias { get; set; } = _clear_field_alias_value._false;

        public enum _clear_field_alias_value
        {
            /// <summary>
            /// <para>CLEAR_ALIAS</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("CLEAR_ALIAS")]
            [GPEnumValue("true")]
            _true,

            /// <summary>
            /// <para>DO_NOT_CLEAR</para>
            /// <para></para>
            /// <para></para>
            /// </summary>
            [Description("DO_NOT_CLEAR")]
            [GPEnumValue("false")]
            _false,

        }

        /// <summary>
        /// <para>Updated Input Table</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Updated Input Table")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _out_table { get; set; }


        public AlterField SetEnv(object workspace = null)
        {
            base.SetEnv(workspace: workspace);
            return this;
        }

    }

}